<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Orderinfo extends Model
{
    //购物车
    
    protected $table = 'yds_order_info';

    protected $primaryKey = 'order_id';

    //关闭更新  'updated_at`, `created_at' 字段
    public $timestamps = false;

    //一对一关系,我下的订单的会员
    public function hasoneUsersReg()
    {
        return $this->hasOne('App\Models\UsersReg','uid','userid');
    }

    //一对一关系,收到的订单会员
    public function hasoneUsers()
    {
        return $this->hasOne('App\Models\UsersReg','uid','uid');
    }

    //对应的订单商品的信息（一对多）
    public function hasManyOrdergoods()
    {
        return $this->hasMany('App\Models\Ordergoods','order_id','order_id');
    }
}
